﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="System.Collections.Generic" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	位置图片详情
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        function setCenter(Xelement) {
            var parent = Xelement.parentNode;
//            parent.style.position = "relative";
//            Xelement.style.position = "absolute";
//            var left = (parent.clientWidth - Xelement.clientWidth) / 2;
//            var top = (parent.clientHeight - Xelement.clientHeight) / 2;
//            Xelement.style.left = left + "px";
//            Xelement.style.top = top + "px";
        }
    </script>
    
    <% 
        Position position = (Position)ViewData["position"];
        PositionPicture picture = (PositionPicture)ViewData["picture"];
        PositionPicture firstRecord = (PositionPicture)ViewData["firstRecord"];
        PositionPicture lastRecord = (PositionPicture)ViewData["lastRecord"];
        long prePictureId = (long)ViewData["prePictureId"];
        long nextPictureId = (long)ViewData["nextPictureId"];
    %>

    <h3>图片位置详情</h3>

    <table cellpadding="4" cellspacing="0" class="com_from_table2" style="width:756px;">
        <tr>
            <td class="lab" style="width:100px;font-weight:bold;"><%=position.Type == 1 ? "堆场" : "尾矿库" %>名称：</td>
            <td><%=ViewData["stackName"]%></td>
        </tr>
        <tr>
            <td class="lab" style="font-weight:bold;">位置名称：</td>
            <td><%=position.Name %></td>
        </tr>
        <tr>
            <td class="lab" style="font-weight:bold;">位置描述：</td>
            <td><%=position.Description %></td>
        </tr>
    </table>

    <table cellpadding="3" cellspacing="0" class="com_from_table2" style="margin-top:6px; width:756px;">
        <tr>
            <th colspan="2" style=" text-align:left;">
                <span style="margin-left:15px"><% if (firstRecord != null && firstRecord.Id != picture.Id) { %><%=Html.ActionLink("首条", "Detail", new { positionId = position.Id, pictureId = firstRecord.Id })%><%}else { %>首条<%} %></span>
                <span style="margin-left:15px"><% if (prePictureId > 0) { %><%=Html.ActionLink("前一条", "Detail", new { positionId = position.Id, pictureId = prePictureId })%><%}else { %>前一条<%} %></span>
                <span style="margin-left:15px"><%=picture.Date.ToString("yyyy-MM-dd")%></span>
                <span style="margin-left:15px"><% if (nextPictureId > 0) { %><%=Html.ActionLink("后一条", "Detail", new { positionId = position.Id, pictureId = nextPictureId })%><%}else { %>后一条<%} %></span>
                <span style="margin-left:15px"><% if (lastRecord != null && lastRecord.Id != picture.Id) { %><%=Html.ActionLink("末条", "Detail", new { positionId = position.Id, pictureId = lastRecord.Id })%><%}else { %>末条<%} %></span>
                <span style="margin-left:15px; font-weight:normal;">(第<strong style="margin:0 3px;"><%=ViewData["index"]%></strong>页 / 共<span style="margin:0 2px;"><%=ViewData["totalCount"]%></span>页)</span>
            </th>
        </tr>
        <tr>
            <td style="width:80%; padding:10px 0; text-align:center; height:480px; background-color:#efefef;">
                <div style=" margin:5px 12px; padding:10px; vertical-align:middle; border:2px solid #e4e4e4; background:#fff;">
                <img id="currentImg" onclick="showPicInNewWindow();" src="<% if (!string.IsNullOrEmpty(picture.Pic1)) {%><%=Url.Content(picture.Pic1) %><%}else {%>../../Content/empty.png<%} %>" alt="" onload="setCenter(this)" class="thumbnailbig" />
                </div>
               <div style="margin:0 2em 0 2em; text-align:left; text-indent:2em;">
                   <span id="currentDesc"><%= picture.PicDesc1%></span>
               </div>
            </td>
            <td id="pics" class="tb_thumb_area">

                <div <% if (!string.IsNullOrEmpty(picture.Pic1)) {%>onclick="changePic(1);"<%} %>><img id="pic1" src="<% if (string.IsNullOrEmpty(picture.Pic1)) {%>../../Content/empty.png<%}else{ %><%=Url.Content(picture.Pic1) %><%} %>" alt="" onload="setCenter(this)" class="img_thumb" /></div>
                <div style="display:none" id="picDesc1"><%= picture.PicDesc1 %></div>
                
                <div <% if (!string.IsNullOrEmpty(picture.Pic2)) {%>onclick="changePic(2);"<%} %>><img id="pic2" src="<% if (string.IsNullOrEmpty(picture.Pic2)) {%>../../Content/empty.png<%}else{ %><%=Url.Content(picture.Pic2) %><%} %>" alt="" onload="setCenter(this)" class="<% if (string.IsNullOrEmpty(picture.Pic2)) {%>hide<%}else{ %>img_thumb<%} %>" /></div>
                <div style="display:none" id="picDesc2"><%= picture.PicDesc2 %></div>

                <div <% if (!string.IsNullOrEmpty(picture.Pic3)) {%>onclick="changePic(3);"<%} %>><img id="pic3" src="<% if (string.IsNullOrEmpty(picture.Pic3)) {%>../../Content/empty.png<%}else{ %><%=Url.Content(picture.Pic3) %><%} %>" alt="" onload="setCenter(this)" class="<% if (string.IsNullOrEmpty(picture.Pic2)) {%>hide<%}else{ %>img_thumb<%} %>" /></div>
                <div style="display:none" id="picDesc3"><%= picture.PicDesc3 %></div>

                <div <% if (!string.IsNullOrEmpty(picture.Pic4)) {%>onclick="changePic(4);"<%} %>><img id="pic4" src="<% if (string.IsNullOrEmpty(picture.Pic4)) {%>../../Content/empty.png<%}else{ %><%=Url.Content(picture.Pic4) %><%} %>" alt="" onload="setCenter(this)" class="<% if (string.IsNullOrEmpty(picture.Pic2)) {%>hide<%}else{ %>img_thumb<%} %>" /></div>
                <div style="display:none" id="picDesc4"><%= picture.PicDesc4 %></div>
            </td>
        </tr>
    </table>


            
    <%--<table cellpadding="4" cellspacing="0" class="com_detail_table" style="width:956px;">
        <tr>
            <th colspan="8">位置图片详情</th>
        </tr>
        <tr>
            <td><%=position.Type == 1 ? "堆场" : "尾矿库" %>名称：</td>
            <td colspan="7"><%=ViewData["stackName"]%></td>
        </tr>
        <tr>
            <td width="20%">位置名称:</td>
            <td width="80%" colspan="7"><%=position.Name%></td>
        </tr>
        <tr>
            <td width="20%">位置描述：</td>
            <td width="80%" colspan="7">
                <%=position.Description %>
            </td>
        </tr>
        <tr>
            <td colspan="7">
                <span style="margin-left:15px"><% if (firstRecord != null && firstRecord.Id != picture.Id) { %><%=Html.ActionLink("第一条", "Detail", new { positionId = position.Id, pictureId = firstRecord.Id })%><%}else { %>第一条<%} %></span>
                <span style="margin-left:15px"><% if (prePictureId > 0) { %><%=Html.ActionLink("前一条", "Detail", new { positionId = position.Id, pictureId = prePictureId })%><%}else { %>前一条<%} %></span>
                <span style="margin-left:15px"><%=picture.Date.ToString("yyyy-MM-dd")%></span>
                <span style="margin-left:15px"><% if (nextPictureId > 0) { %><%=Html.ActionLink("后一条", "Detail", new { positionId = position.Id, pictureId = nextPictureId })%><%}else { %>后一条<%} %></span>
                <span style="margin-left:15px"><% if (lastRecord != null && lastRecord.Id != picture.Id) { %><%=Html.ActionLink("第一条", "Detail", new { positionId = position.Id, pictureId = lastRecord.Id })%><%}else { %>最后一条<%} %></span>
                <span style="margin-left:15px">(<%=ViewData["index"]%>/<%=ViewData["totalCount"]%>)</span>
            </td>
            <td>&nbsp</td>
        </tr>
        <tr>
           <td colspan="7">
               <div style="width:600px;height:450px;">
                   <img id="currentImg" onclick="showPicInNewWindow();" src="<% if (!string.IsNullOrEmpty(picture.Pic1)) {%><%=Url.Content(picture.Pic1) %><%}else {%>../../Content/empty.png<%} %>" alt="" onload="setCenter(this)" class="thumbnailbig" />
               </div>
               <div><span id="currentDesc"><%= picture.PicDesc1%></span></div>
           </td>
           <td id="pics">
                <div <% if (!string.IsNullOrEmpty(picture.Pic1)) {%>onclick="changePic(1);"<%} %> style="border:1px solid #e4e4e4;width:100px;height:75px;text-align:center;line-height:75px;"><img id="pic1" src="<% if (string.IsNullOrEmpty(picture.Pic1)) {%>../../Content/empty.png<%}else{ %><%=Url.Content(picture.Pic1) %><%} %>" alt="" onload="setCenter(this)" class="thumbnail" /></div>
                <div style="display:none" id="picDesc1"><%= picture.PicDesc1%></div>
                
                <div <% if (!string.IsNullOrEmpty(picture.Pic2)) {%>onclick="changePic(2);"<%} %> style="border:1px solid #e4e4e4;width:100px;height:75px;text-align:center;line-height:75px;margin-top:25px;"><img id="pic2" src="<% if (string.IsNullOrEmpty(picture.Pic2)) {%>../../Content/empty.png<%}else{ %><%=Url.Content(picture.Pic2) %><%} %>" alt="" onload="setCenter(this)" class="thumbnail" /></div>
                <div style="display:none" id="picDesc2"><%= picture.PicDesc2%></div>

                <div <% if (!string.IsNullOrEmpty(picture.Pic3)) {%>onclick="changePic(3);"<%} %> style="border:1px solid #e4e4e4;width:100px;height:75px;text-align:center;line-height:75px;margin-top:25px;"><img id="pic3" src="<% if (string.IsNullOrEmpty(picture.Pic3)) {%>../../Content/empty.png<%}else{ %><%=Url.Content(picture.Pic3) %><%} %>" alt="" onload="setCenter(this)" class="thumbnail" /></div>
                <div style="display:none" id="picDesc3"><%= picture.PicDesc3%></div>

                <div <% if (!string.IsNullOrEmpty(picture.Pic4)) {%>onclick="changePic(4);"<%} %> style="border:1px solid #e4e4e4;width:100px;height:75px;text-align:center;line-height:75px;margin-top:25px;"><img id="pic4" src="<% if (string.IsNullOrEmpty(picture.Pic4)) {%>../../Content/empty.png<%}else{ %><%=Url.Content(picture.Pic4) %><%} %>" alt="" onload="setCenter(this)" class="thumbnail" /></div>
                <div style="display:none" id="picDesc4"><%= picture.PicDesc4%></div>
           </td>
        </tr>
    </table>--%>
    
    <div style="margin-top:15px">
        <input type="button" value="返回位置列表" onclick="gotoList();" />
    </div>

    <script type="text/javascript">
        function changePic(index) {
            $("#currentImg").attr("src", $("#pic" + index).attr("src"));
            $("#currentDesc").text($("#picDesc" + index).text());
            setCenter(document.getElementById("currentImg"));
        }

        function showPicInNewWindow() {
            window.open($("#currentImg").attr("src"));
        }
	
	function gotoList() {
	    document.location.href = '<%=Url.Content("~/Position/Search?stackId=" + (position.Type -1) + "-" + position.StackId)%>';
	}
    </script>
</asp:Content>
